package com.sjp.utils;

import com.sjp.entity.Brand;
import com.sjp.entity.Cell;
import com.sjp.entity.Layer;

public class LayerUtils {
    public static Layer builderLayer(Integer rowNum,Integer colNum){
        Layer layer =new Layer(rowNum,colNum);
        Brand[] brands =BrandUtils.bulderBrand(layer.getCapacity());
        System.out.println("验证图======================");
        Cell[][] cells = layer.getCells();
        int flag =0;
        for (int row = 0; row < cells.length; row++) {
            for (int col = 0; col < cells.length; col++) {
                System.out.println(row+"\t"+ col);
                Cell c = new Cell();
                c.setState(1);

//                c.setBrand(brands[flag++]);
                Brand b = brands[flag++];

                //链式
                c.setBrand(b);
                b.setCell(c);
                cells[row][col]=c;
            }
        }
        return layer;
    }
}
